﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using AutoClub.Core.Domain;
using AutoClub.Core.Resources;

namespace AutoClub.Models
{
    /// <summary>
    /// View Model para agregar una carrera al sistema
    /// </summary>
    public class AddRaceModel
    {
        #region Properties

        public IEnumerable<CarCategory> Categories { get; private set; }

        [Required(AllowEmptyStrings = false, ErrorMessageResourceType = typeof(CoreResources), ErrorMessageResourceName = "RequiredFieldMessage")]
        [Display(Name = "StartDateField", ResourceType = typeof(CoreResources))]
        public DateTimeOffset? StartDate { get; set; }

        [Display(Name = "EndDateField", ResourceType = typeof(CoreResources))]
        public DateTimeOffset? EndDate { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessageResourceType = typeof(CoreResources), ErrorMessageResourceName = "RequiredFieldMessage")]
        //[MinLength(1, ErrorMessageResourceType = typeof(CoreResources), ErrorMessageResourceName = "MinLenghtFieldMessage")]
        [Display(Name = "MechanicsMaxAmountField", ResourceType = typeof(CoreResources))]
        public int MechanicsMaxAmount { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessageResourceType = typeof(CoreResources), ErrorMessageResourceName = "RequiredFieldMessage")]
        [Display(Name = "CategoryField", ResourceType = typeof(CoreResources))]
        public int SelectedCategory { get; set; }

        #endregion

        #region Constructor

        public AddRaceModel()
        {
            this.Categories = new List<CarCategory>();
        }

        public AddRaceModel(IEnumerable<CarCategory> categories)
        {
            this.Categories = categories;
        }

        #endregion
    }
}